<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible">
<title>申请退换货--<!--{$mallname}--></title>
<!--{include(file='static.html')}-->
</head>
<body>
<!--{include(file='head.html')}-->
<script src="template/jslib/country/country.js" type="text/javascript"></script>

	<!--主体内容-->
	<div class="container">
    <!--左侧菜单-->
		<div class="per_left">
            <!--{include(file='userleft.html')}-->
        </div>
        <!--左侧菜单end-->
        <div class="per_right">
        	<div class="per_right_cont">
            	<h3>申请退换货</h3>
				<!--{if $hint}-->
				<p class="userhint<!--{$hint.type}-->">
					<!--{$hint.hint}-->
				</p>
				<!--{else}-->
				
				<div class="add_list">
                	<table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <th width="50%" colspan="2">商品</th>
						<th width="10%">价格</th>
                        <th width="10%">优惠</th>
                        <th width="30%">赠品</th>
                      </tr>
					  <tr>
                        <td width="5%" align="left">
							<a href="<!--{url('index','item','index','itemid=$order[itemid]')}-->" target="_blank">
								<img src="<!--{$order.itemimg}-->_50x50.jpg" width="50" height="50" onerror="this.onerror='',this.src='images/nopicture.jpg'" class="mid"/>
							</a>
						</td>
						<td width="55%" style="text-align:left;">
							<a href="<!--{url('index','item','index','itemid=$order[itemid]')}-->" target="_blank">
							<!--{$order.itemname}-->
							</a>
							 <!--{if $order.mealid}-->
								<span class="text_orange">[套餐：<!--{$order.mealtitle}-->]</span>
							<!--{/if}-->
						</td>
						<td>￥<!--{getPrice($order.price)}--></td>
                        <td nowrap>
							<!--{if $order.discount}-->
							限折优惠：￥<!--{getPrice($order.discount * $order.num)}-->
							<!--{elseif $order.tuan}-->
							团购优惠：￥<!--{getPrice($order.tuan * $order.num)}-->
							<!--{/if}-->
						</td>
						<td>
							<!--{if $gifts}-->
								<!--{$tmpgifts = unserialize($gifts[gift]);}-->
								<!--{foreach $tmpgifts gift}-->
									<div>
										<span class="text_orange">[赠品]</span>
										<a href="<!--{url('index','item','index','itemid=$gift[gitemid]')}-->" target="_blank" ><!--{$gift.gitemname}--></a>
										<span class="text_orange">x<!--{$gift.num}--></span>
									</div>
								<!--{/foreach}-->
							<!--{else}-->
								--
							<!--{/if}-->
						</td>
                      </tr>
					</table>
				 </div>
				<div class="add_list">
					<div class="add_list2">
						<!--{$backinfo}-->
					</div>
				</div>
				
				<div class="add_list">
					<div class="add_list2">
						<form action="<!--{url('index','aftersale','applyok')}-->" name="theform" id="theform" method="post" onsubmit="return checkform()">
						<h1>
							期望处理方式:
							<!--{if $ways['repair']}-->
							<input type="radio" value="repair" name="way" <!--{if !$ways['canrepair']}-->disabled<!--{/if}--> 
							onclick="showaddr('repair')"/> 返修 
							<!--{/if}-->
							<input type="radio" value="change" name="way" <!--{if !$ways['canchange']}-->disabled<!--{/if}-->
							onclick="showaddr('change')"/> 换货
							<input type="radio" value="back" name="way"   <!--{if !$ways['canback']}-->disabled<!--{/if}-->
							onclick="showaddr('back')"/> 退货
						</h1>
						<div class="add_list3">
								<ul>
									<li style="margin-bottom:100px;">
										<label><em>*</em>产品问题描述</label>
										<p>
											<textarea id="problem" name="problem" cols="60" rows="5"></textarea>
										</p>
									</li>
									<!--{if $productopt}-->
									<li id="prd">
										<label><em>*</em>更换为</label>
										<p>
											<select name="productid" id="productid">
												<option value="0">请选择</option>
												<!--{$productopt}-->
											</select>
										</p>
									</li>
									<!--{/if}-->
								</ul>
								<ul id="addr">
									<li>
										<label><em>*</em>收货人姓名：</label>
										<p>
											<input type="text" name="receiver" id="receiver" value="<!--{def($trade.receiver_name,'')}-->" /> 
										</p>
									</li>
									<li>
										<label><em>*</em>收货区域：</label>
										<p>
											<select name="province" id="province" onchange="$.country.getCity()" autocomplete="off">
												<!--{$provinceopt}-->
											</select>
											-
											<select name="city" id="city" onchange="$.country.getDistrict()" autocomplete="off">
												<!--{$cityopt}-->
											</select>
											-
											<select name="district" id="district" onchange="$.country.getZip()" autocomplete="off">
												<!--{$districtopt}-->
											</select>
										</p>
									</li>
									<li>
										<label><em>*</em>街道地址：</label>
										<p>
											<input type="text" value="<!--{def($trade.receiver_address,'')}-->" name="address" id="address" size="40"/> 
										</p>
									</li>
									<li>
										<label><em>*</em>邮政编码：</label>
										<p>
											<input type="text" value="<!--{def($trade.receiver_zip,'')}-->" name="zipcode" id="zipcode" />
											<script type="text/javascript">
												$.country.init(false);
											</script>
										</p>
									</li>
									<li>
										<label><em>*</em>电话/手机：</label>
										<p>
											<input type="text" value="<!--{def($trade.receiver_link,'')}-->" name="link" id="link" />
										</p>
									</li>
									<li>
										<label>&nbsp;</label>
										<p>
											<input type="submit" class="o_button" value="提交申请"/>
											<input type="hidden" value="<!--{$order['orderid']}-->" name="orderid">
										</p>
									</li>
								</ul>
							</form>
						</div>
					</div>
				</div>
				
				<!--{/if}-->

				
            </div>
        </div>
        <div class="clear"></div>
	</div>
    <!--主体内容 end-->
<!--{include(file='foot.html')}-->
</body>
</html>
<script type="text/javascript">
function showaddr(type) {
	var $prd  = $("#prd") ,
		$addr = $("#addr");
	if(type == 'back') {
		if($prd.length) $prd.hide();
		$addr.hide();
	} else if(type == "repair") {
		if($prd.length) $prd.hide();
	} else if(type == "change") {
		if($prd.length) $prd.show();
		$addr.show();
	}
}

function checkform() {
	var $way = $("input[name='way']:checked");
	if($way.length==0) {
		jAlert("请选择期望处理方式！");
		return false;
	}
	var problem = $.trim($("#problem").val());
	if(problem.length < 2) {
		jAlert("请输入详细问题描述");
		return false;
	}
	
	var $prd = $("#prd");
	if( ($prd.length > 0) && !$prd.is(":hidden") && ($("#productid").val()=='') ) {
		jAlert("请选择需要更换的商品！");
		return false;
	}
	var $addr = $("#addr");
	if(!$addr.is(":hidden")) {
		var receiver = $.trim($("#receiver").val());
		if(!receiver) {
			jAlert("请输入收货人姓名！");
			return false;
		}
		var province = $.trim($("#province").val());
		if(!province) {
			jAlert("请选择省");
			return false;
		}
		var city	= $.trim($("#city").val());
		if(!city) {
			jAlert("请选择市");
			return false;
		}
		var district	= $.trim($("#district").val());
		if(!district) {
			jAlert("请选择区");
			return false;
		}
		var address	= $.trim($("#address").val());
		if(!address) {
			jAlert("请输入街道地址");
			return false;
		}
		var link	= $.trim($("#link").val());
		if(!link) {
			jAlert("请输入联系电话/手机");
			return false;
		}
	}
	return true;
}
</script>
